/*
* Copyright (C) 2020 ~ 2024 chaigec All Rights Reserved.
*
* Author:     chaigec <chaigec@163.com>
* Maintainer: chaigec <chaigec@163.com>

 * Use of this source code is governed by MIT license that can be found in the
 * LICENSE file in the root of the source tree. All contributing project authors
 * may be found in the AUTHORS file in the root of the source tree.
*/

#ifndef MK_RTMP_PLAYER_H
#define MK_RTMP_PLAYER_H
#include "MkRtmpClient.h"
#include "MkMedia/MkMediaSource.h"

class MkApi CMkRtmpPlayer : public CMkRtmpClient, public CMkMediaSource
{
public:
    CMkRtmpPlayer(CMkEvent* pEvent, CMkTimer* pTimer, const MkEventRemovedCallback& RemoveCb);
    ~CMkRtmpPlayer();
    Uint32 StartMediaSource(const MkString& RtmpUrl, const MkSourceResultCallback& ResultCb, const MkEsPacketCallback& EsCb  = nullptr );
    Uint32 StopMediaSource() override;
protected:
    Uint32 OnHandSharked() override;
    Uint32 OnConnectResult(BOOL bSuccess) override;
    Uint32 OnCreateStreamResult(BOOL bSuccess) override;
    Uint32 OnAudio(const Uint8* pBuf, Uint32 nLen, Uint32 TimeStamp) override;
    Uint32 OnVideo(const Uint8* pBuf, Uint32 nLen, Uint32 TimeStamp) override;
    Uint32 OnMetaData(const MkVector<MkAmfObject>& VecObj) override;
};

#endif